/*
 * Author: JacksonCoder
 * FileName: MyQueue
 * Version: 1.0.0
 * Date: 2025/2/12
 */

import java.util.Stack;

public class MyQueue<T> {

    private Stack<T> stackIn;
    private Stack<T> stackOut;

    public MyQueue() {
        stackIn = new Stack<T>();
        stackOut = new Stack<T>();
    }

    public void enQueue(T element) {
        stackIn.push(element);
    }

    public T deQueue() {
        if (stackOut.isEmpty()) {
            while (!stackIn.isEmpty()) {
                stackOut.push(stackIn.pop());
            }
        }
        return stackOut.pop();
    }

    public boolean isEmpty() {
        return stackIn.isEmpty() && stackOut.isEmpty();
    }

}
